STEP 7: When we change the commands inside the event, we change what happens when the collision occurs.

Now when the UFO touches another sprite, that sprite will hide, but nothing will happen to the UFO.

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("space") sprite = codesters.Sprite("ufo") sprite.set_size(0.4) sprite.go_to(-200, -200) sprite.pen_down() sprite.glide_to(-100, -100) def collision(sprite, hit_sprite): sprite.go_to(0,0) hit_sprite.hide() # add any other actions... sprite.event_collision(collision)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)